#include "MyFile.h"
const int MY_MAX = 100;
///-----------------------------------------------------------------------------
MyFile::MyFile(const std::string& szFileName, const Time& time)
: m_szName(szFileName), m_Time(time), m_nFileSize(DEFAULT_SIZE), m_ETYPE(IFile), m_szFileContent(NULL)
{

}
///-----------------------------------------------------------------------------
MyFile::~MyFile(void)
{
	safe_delete(m_szFileContent);
}
///-----------------------------------------------------------------------------
ETYPE MyFile::GetType(void)
{
	return m_ETYPE;
}
///-----------------------------------------------------------------------------
const char* MyFile::GetName()
{
	return m_szName.c_str();
}
///-----------------------------------------------------------------------------
void MyFile::SetFileInfo(char* szFileContent, int nSize)
{
	if (m_szFileContent != szFileContent)
	{
		safe_delete(m_szFileContent);
		m_szFileContent = szFileContent;
		m_nFileSize = nSize;
	}
}
///-----------------------------------------------------------------------------
char* MyFile::GetFileInfo(int& nSize) const
{
	nSize = m_nFileSize;
	return m_szFileContent;
}
//-----------------------------------------------------------------------------
void MyFile::ShowFileInfo(void) const
{
	char szTemp[MY_MAX] = {0};
	if (m_nFileSize != DEFAULT_SIZE)
	{
		_itoa_s(m_nFileSize, szTemp, 10);
	}

	printf("%02d/%02d%/%02d  %02d:%02d   %s%8s %s\n", m_Time.m_nYear + 1900,
		m_Time.m_nMonth + 1, m_Time.m_nDay, m_Time.m_nHour, m_Time.m_nMinute,
		"     ", szTemp, m_szName.c_str());
}
//-----------------------------------------------------------------------------